home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- set -e
-
- pkg=vim-tiny
- variant=tiny
- mandir=/usr/share/man
-
- # two things to do:
- # 1) add /usr/bin/vim.variant as alternative for /usr/bin/vim. Priority are
- # chosen accordingly to the principle: ``more features, higher priority''
- # 2) add /usr/bin/gvim as an alternative for gnome-text-editor for variants
- # built with gnome support. Same principle for the priority above, with the
- # additional constraint that priority should not be higher than gedit's
-
- add_gnome_alternative () {
- if [ -f /usr/bin/gvim ]; then
- update-alternatives --install /usr/bin/gnome-text-editor \
- gnome-text-editor /usr/bin/vim.$variant $1 \
- --slave $mandir/man1/gnome-text-editor.1.gz gnome-text-editor.1.gz \
- $mandir/man1/vim.1.gz
- fi
- }
-
- add_variant_alternative () {
- if [ "$variant" != "tiny" ]; then
- update-alternatives --install /usr/bin/vim vim /usr/bin/vim.$variant $1
- update-alternatives --install /usr/bin/vimdiff vimdiff /usr/bin/vim.$variant $1
- update-alternatives --install /usr/bin/rvim rvim /usr/bin/vim.$variant $1
- fi
- update-alternatives --install /usr/bin/rview rview /usr/bin/vim.$variant $1
- # Since other packages provide these commands, we'll setup alternatives for
- # their manpages, too.
- for i in vi view ex editor ; do
- update-alternatives \
- --install /usr/bin/$i $i /usr/bin/vim.$variant $1 \
- --slave $mandir/fr/man1/$i.1.gz $i.fr.1.gz $mandir/fr/man1/vim.1.gz \
- --slave $mandir/it/man1/$i.1.gz $i.it.1.gz $mandir/it/man1/vim.1.gz \
- --slave $mandir/pl/man1/$i.1.gz $i.pl.1.gz $mandir/pl/man1/vim.1.gz \
- --slave $mandir/ru/man1/$i.1.gz $i.ru.1.gz $mandir/ru/man1/vim.1.gz \
- --slave $mandir/man1/$i.1.gz $i.1.gz \
- $mandir/man1/vim.1.gz
- done
- case "$variant" in
- gtk|gnome|lesstif) # gui enabled variants
- add_gui_variant_alternative $1
- ;;
- esac
- }
-
- add_gui_variant_alternative () {
- for i in gvim gview rgview rgvim evim eview gvimdiff ; do
- update-alternatives --install /usr/bin/$i $i /usr/bin/vim.$variant $1
- done
- }
-
- case "$pkg" in
- vim-tiny)
- add_variant_alternative 10
- ;;
- vim)
- add_variant_alternative 30
- ;;
- vim-nox)
- add_variant_alternative 40
- ;;
- vim-gtk|vim-lesstif)
- add_variant_alternative 50
- ;;
- vim-gnome) # gnome enabled variant
- add_variant_alternative 60
- add_gnome_alternative 45
- ;;
- esac
-
-
-
- exit 0
-